package util;

import entities.User;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;

public class SessionUtil {
    
    public static User getLoggedInUser() {
        
        EntityManagerFactory fact = Persistence.createEntityManagerFactory("vh11_WebApplication1PU");
        EntityManager em = fact.createEntityManager();
        User user = null;
        
        try {
            user = em.find(User.class, 51L);
        }
        finally {
            em.close();
            fact.close();
        }
        
        return user;
    }
    
}
